<?php
if(isset($_REQUEST['id']))
{
	$id=$_REQUEST['id'];
	$sql="SELECT * FROM tailieu WHERE id='$id'";
	$sp=$dp->QueryOne($sql);
	//Đây là trang trình bày chi tiết sp
	include_once("chitiet.php");
}
else
{
	if(isset($_REQUEST['subcat']))
	{
		$linksubcat=$_REQUEST['subcat'];//Chuỗi
		$menu=$dp->LinkToArray($linksubcat);
		$subcat=$menu['id'];
		$sql="SELECT * FROM tailieu 
			  WHERE states='1' 
			  ORDER BY datepost DESC";
		
	}
	else
	{
		if(isset($_REQUEST['idcat']))
		{
			$linkcat=$_REQUEST['idcat'];
			$menu=$dp->LinkToArray($linkcat);
			$cat=$menu['id'];
			$sql="SELECT * FROM tailieu 
			  WHERE states='1'
			  ORDER BY datepost DESC";
		}
		else
		{
			$sql="SELECT * FROM tailieu
			  WHERE states='1' 
			  ORDER BY datepost DESC";
		}
	}
	$sp=$dp->QueryAll($sql);
	include_once("thongtin.php");
}
?>
